package com.yang.service.Impl;

import com.yang.mapper.ArchivesMapper;
import com.yang.pojo.Archives;
import com.yang.service.ArchivesService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author 杨天可
 * @Date 2021/3/12 9:22
 * @Version 1.0
 */
@Service("archivesService")
public class ArchivesServiceImpl implements ArchivesService {

    @Resource
    ArchivesMapper archivesMapper;

    @Override
    public Archives getArchivesByUserId(Integer id) {
        return archivesMapper.getArchivesByUserId(id);
    }

    @Override
    public int sava(Archives archives) {
        return archivesMapper.insert(archives);
    }

    @Override
    public int update(Archives archives) {
        return archivesMapper.updateByPrimaryKey(archives);
    }

    @Override
    public List<Archives> getArchivesList() {
        return archivesMapper.selectAll();
    }

    @Override
    public int deleteById(Integer id) {
        return archivesMapper.deleteById(id);
    }

    @Override
    public int deleteByyUserId(Integer userId) {
        return archivesMapper.deleteByyUserId(userId);
    }
}
